package cn.bonoon.kernel.web.handlers.loader;

import java.lang.reflect.AnnotatedElement;

import cn.bonoon.handler.impl.StandardAutoManager;
import cn.bonoon.kernel.events.ReadEvent;
import cn.bonoon.kernel.support.models.Page;
import cn.bonoon.kernel.support.searcher.Finder;
import cn.bonoon.kernel.support.services.ISearchable;
import cn.bonoon.kernel.web.annotations.AutoDataLoader;

/**
 * <pre>
 * 用于datagrid的分页加载数据和不分页加载数据
 * 是否分页加载数据，框架会自动根据查询条件对象的类型进行判断
 * </pre>
 * @author jackson
 *
 * @param <E>
 */
public class ItemLoaderHandler extends AbstractSearchableLoaderHandler {
	
	public ItemLoaderHandler(ISearchable searchable, Class<?> resultClass, Class<?> queryClass, AnnotatedElement aEle) throws Exception {
		super(searchable, resultClass, queryClass, aEle);
	}

	public ItemLoaderHandler(StandardAutoManager manager, Class<?> resultClass, Class<?> queryClass, AutoDataLoader loader) throws Exception{
		super(manager, resultClass, queryClass, loader);
	}

	@Override
	protected Page __parseResult(Finder finder, ReadEvent event) throws Exception {
		return finder.getPage();
	}
	
}
